#pragma once

#include <iostream>
#include <fstream>

struct area_infor
{		
	double start_latitude;//起始纬度 区域左上方
	double start_longitude;//起始经度
	int over_lat;//跨域过的纬度 30 second
	int over_long;//跨域过的纬度
};
typedef struct area_infor AreaInf;

//class to load dem data from disk
class Dem_Area
{
private:	

	std::string _file_path_name;//dem 文件名
	std::ifstream finhead;
	std::ifstream findem;

	int _skipx;					//在经度方向取点的相隔数
	int _skipy;					//在纬度方向取点的相隔数	

	int _xsimpleCount;			//x方向采样点数
	int _ysimpleCount;			//y方向采样点数

	AreaInf * areainfor;		//地域结构体指针

	unsigned char * _dem_data_blob;		//dem数据

	unsigned char * _dem_data_origin_blob;		//dem数据

public:

	Dem_Area(std::string file_name, int skipx, int skipy);	

	Dem_Area(std::string file_name, int width, int height, int);	

	bool load_dem_file();

	bool load_dem_file_avr();

	unsigned char* load_dem_file_avr(unsigned int lenx, unsigned int leny);

	bool get_area_infor();	

	~Dem_Area();

	void smooth(float key, int pass);

	unsigned char * get_dem_data()
	{
		return _dem_data_blob;		
	}

	int getXsimpleCount()
	{
		return this->_xsimpleCount;
	}

	AreaInf * getAreainfor()
	{
		return this->areainfor;
	}

	int getYsimpleCount()
	{
		return this->_ysimpleCount;
	}

	int getSkipX()
	{
		return this->_skipx;
	}

	int getSkipY()
	{
		return this->_skipy;
	}
};
